package com.lyy.config;

import com.lyy.entity.Constant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;


/**
 * @author Liangyaoyun
 */
@Configuration
@PropertySource("classpath:application.properties")
public class ConstantConfig {
    @Value("${server.port}")
    private String port;
    @Value("${spring.application.name}")
    private String applicationName;
    @Bean
    public Constant constant(){
        Constant constant=new Constant();
        constant.setPort(port);
        constant.setApplicationName(applicationName);
        return constant;
    }
}
